//2009/09/09 17:51:57
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class VolumeGuess
{
public:
    int correctVolume(vector <string> q, int numberOfBoxes, int ithBox)
    {
        int ret = 0;
        for (int i=0; i<q.size(); i++)
        {
            stringstream s(q[i]);
            int a, b, c;
            char d;
            s >> a >> d >> b >> d >> c;
            if (a==ithBox || b==ithBox)
                ret = max(ret, c);
        }
		return ret;
    }
};
